/**
 * 
 */
package edu.arizona.eller.mis.hippo.factory;

import edu.arizona.eller.mis.hippo.adapter.ProductSearch;
import edu.arizona.eller.mis.hippo.adapter.impl.AmazonAdapter;
import edu.arizona.eller.mis.hippo.adapter.impl.CraigsListAdapter;
import edu.arizona.eller.mis.hippo.adapter.impl.EbayAdapter;


public class ProductSearchFactory {
	//One line singleton
	private static final ProductSearchFactory _INSTANCE = new ProductSearchFactory();

	private ProductSearchFactory(){
		//Hidden constructor
	}
	
	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
	}
	
	public static ProductSearchFactory getInstance(){
		return _INSTANCE;
	}
	
	public ProductSearch getProductSearch(String className){
		if(className.equals("craigslist")){
			return new CraigsListAdapter();
		}else if(className.equals("amazon")){
			return new AmazonAdapter();
		}else if(className.equals("ebay")){
			return new EbayAdapter();
		}else{
			return null;
		}
	}
}
